Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 9x 9x 9x 1x 8x 1x 7x 1x 6x 1x 5x 1x 4x 2x 2x | export function mapLoginErrorMessage(
errorMessage: string,
t: (key: string) => string
): string {
const normalizedMessage = String(errorMessage || '').toLowerCase();
if (normalizedMessage.includes('user not found')) {
return t('auth.errors.usernameNotFound');
}
if (normalizedMessage.includes('invalid password')) {
return t('auth.errors.incorrectPassword');
}
if (normalizedMessage.includes('account inactive')) {
return t('auth.errors.accountDeactivated');
}
if (normalizedMessage.includes('authentication failed')) {
return t('auth.errors.invalidCredentials');
}
if (normalizedMessage.includes('forbidden')) {
return t('auth.errors.accessDeniedAdminUI');
}
if (normalizedMessage.includes('two-factor') || normalizedMessage.includes('2fa')) {
return errorMessage || 'Two-factor authentication required';
}
return errorMessage;
}
|